﻿@model IEnumerable<Coticula.Web.Models.Problems>

@{
    ViewBag.Title = "Problems list";
}

@{
    var pageMenu = new MvcHtmlString[] { };

    if (Roles.IsUserInRole("Administrator"))
    {
        Array.Resize(ref pageMenu, pageMenu.Length + 1);
        pageMenu[pageMenu.Length - 1] = @Html.ActionLink("Create", "Create");
    }
    ViewBag.PageMenu = pageMenu;
}

<h2>@ViewBag.Title</h2>

@{
    var webGrid = new WebGrid(Model, canSort: false, canPage: false, rowsPerPage: ViewBag.PageSize);
    int columnsCount = 1;
    WebGridColumn[] columns = new WebGridColumn[columnsCount];
    columns[0] = webGrid.Column("Name", format: @<text>@Html.ActionLink((string)(item.Name), "Details", "Problem", new { id = item.Id }, null)</text>);
    @webGrid.GetHtml(columns: webGrid.Columns(columns))
}

@Html.Partial("~/Views/Shared/_PagedTablePartial.cshtml")
